/**
 * Created by zhengjiahao on 2017/4/16.
 */

ADF.editpart.BaseEditpart = function () {
    ADF.editpart.BaseEditpart.superclass.constructor.call(this);
};

COM.util.defineClass(ADF.editpart.BaseEditpart, AGEF.WidgetGraphicalEditPart, {

    propertyChange: function (evt) {
        ADF.editpart.BaseEditpart.superclass.propertyChange.call(this, evt);
        if (AGEF.PropertyChangeEvent.UPDATE_EVENT == evt.getType()) {
            if (ADF.model.BaseModel.PROPERTY_ADFTAG == evt.getPropertyName()) {
                this.getFigure().getWidget().setADFTag(evt.newValue);
            } else if (ADF.model.BaseModel.PROPERTY_BORDER == evt.getPropertyName()) {
                this.getFigure().getWidget().setBorder(evt.newValue);
            } else if (ADF.model.BaseModel.PROPERTY_COLOR == evt.getPropertyName()) {
                this.getFigure().getWidget().setColor(evt.newValue);
            } else if (ADF.model.BaseModel.PROPERTY_BACKGROUND == evt.getPropertyName()) {
                this.getFigure().getWidget().setBackground(evt.newValue);
            } else if (ADF.model.BaseModel.PROPERTY_FONTSIZE == evt.getPropertyName()){
                this.getFigure().getWidget().setFontsize(evt.newValue);
            } else if (ADF.model.BaseModel.PROPERTY_TITLE == evt.getPropertyName()){
                this.getFigure().getWidget().setTitle(evt.newValue);
            } else if (ADF.model.BaseModel.PROPERTY_CONFIG == evt.getPropertyName()){
                this.getFigure().getWidget().setConfig(evt.newValue);
            }
        }
    },

    createEditPolicies: function(){
        this.installEditPolicy(COM.gef.EditPolicy.COMPONENT_ROLE, new AGEF.ComponentEditPolicy());
    },
});